package test.h0819;

import java.util.*;

public class Main2 {
    static class Node{
        int val;
        Node prev;
        Node next;

        public Node(int val) {
            this.val = val;
        }
    }
    static class CycleList{
        Node head;
        Node tail;
        int size;

        public CycleList(int n) {
            for (int i = 1; i <= n; i++) {
                this.add(i);
            }
        }
        public void add(int val){
            Node node=new Node(val);
            if (size==0){
                head=node;
                tail=node;
                head.prev=head;
                head.next=head;
            }else {
                node.next=head;
                head.prev=node;
                tail.next=node;
                node.prev=tail;
                tail=node;
            }
            this.size++;
        }
        public Node remove(Node node){
            Node n = node.next;
            Node p = node.prev;
            n.prev=p;
            p.next=n;
            node.next=null;
            node.prev=null;
            if (head==node){
                this.head=n;
            }

            if (tail==node){
                this.tail=p;
            }
            this.size--;
            return n;
        }

        public int getSize() {
            return size;
        }
    }

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String s = sc.nextLine();
        int m = Integer.parseInt(s);
        if (m>100||m<0){
            System.out.println("ERROR!");
        }else {
            System.out.println(getRes(m));
        }
    }

    private static String getRes(int m) {
        CycleList cycleList = new CycleList(100);

        Node cur = cycleList.head;
        while(cycleList.size>=m){
            for (int i = 0; i < m; i++) {
                if (i==m-1){
                    cur= cycleList.remove(cur);
                }else {
                    cur=cur.next;
                }
            }
        }
        List<Integer> list=new ArrayList<>();
        while (cycleList.size>0){

            list.add(cur.val);
            cur=cycleList.remove(cur);
        }
        Collections.sort(list);
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < list.size(); i++) {
            builder.append(list.get(i));
            if (i!=list.size()-1){
                builder.append(",");
            }
        }
        return builder.toString();
    }
}
